package com.baidu.kshpt.controller;

import com.baidu.kshpt.config.GoFastdfsClient;
import com.baidu.kshpt.entity.UploadResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @Author dengze_邓泽
 * @Date 2021/5/31 18:02
 * @Version 1.0
 */
@RestController
@RequestMapping("fileUpload")
public class FileUploadController {
    @Autowired
    private GoFastdfsClient goFastdfsClientUtil;

    @PostMapping("test")
    public UploadResult test(MultipartFile file) throws IOException {
        String sixCode = "123444";
        UploadResult upload = goFastdfsClientUtil.upload(file, sixCode);
        return upload;
    }

}
